package com.usian.user.controller.v1;

import com.usian.apis.user.ApUserRealnameControllerApi;
import com.usian.common.contants.user.AdminConstans;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.ApUserIdentityService;
import com.usian.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController implements ApUserRealnameControllerApi {
@Autowired
private ApUserRealnameService apUserRealnameService;

    @Override
    @PostMapping("/list")
    public ResponseResult loadListByStatus(AuthDto dto) {
        return apUserRealnameService.loadListByStatus(dto);
    }


    /**
     * 用户实名认证  认证通过修改审核状态
     * @param dto
     * @return
     */
    //审核成功
    @PostMapping("/authPass")
    public ResponseResult idEntityPass(@RequestBody AuthDto dto){
        return apUserRealnameService.updateStatus(dto, AdminConstans.PASS_AUTH);
    }

    //驳回审核
    @PostMapping("/authFail")
    public ResponseResult idEntityFail(@RequestBody AuthDto dto){
        return apUserRealnameService.updateStatus(dto,AdminConstans.FAIL_AUTH);
    }


}
